import request from '@/utils/request'

const baseApi1 = process.env.VUE_APP_BASE_API2

// 获取列表数据
export function fetchTree(query) {
  return request({
    url: baseApi1 + '/group/tree',
    method: 'get',
    params: query
  })
}

// 添加
export function addObj(obj) {
  return request({
    url: baseApi1 + '/group/insertGroup',
    method: 'post',
    data: obj
  })
}

// 获取详情
export function getObj(id) {
  return request({
    url: baseApi1 + '/group/' + id,
    method: 'get'
  })
}

// 更新
export function updateObj(data) {
  return request({
    url: baseApi1 + '/group/updateGroup',
    method: 'post',
    data: data
  })
}

// 删除
export function delObj(id) {
  return request({
    url: baseApi1 + '/group/delete/' + id,
    method: 'get'
  })
}

// 获取权限
export function getMenuAuthority(id) {
  return request({
    url: baseApi1 + '/group/' + id + '/authority/menu',
    method: 'get'
  })
}

// 修改权限
export function modifyMenuAuthority(id, data) {
  return request({
    url: baseApi1 + '/group/' + id + '/authority/menu',
    method: 'post',
    params: data
  })
}

